#include "rtos.h"
#include "led.h"

TaskHandle_t Start_led1Handle;

uint8_t TaskSetFlag[task_toal]={0};
task_config TaskGrouplist[task_toal]={

{Led1_Ctl,"Led1",Task_Stk_Size,NULL,START_Task_Prio,&Start_led1Handle}

};
void SetTaskFlag(task_id ID,Task_Status status)
{
	TaskSetFlag[ID]=status;
}
Task_Status Get_TaskFlag(task_id ID)
{
	return ((Task_Status)(TaskSetFlag[ID]));
}

void Task_Start(task_id ID)
{
	if(Get_TaskFlag(ID)==TASK_CLEAR)
	{
		taskENTER_CRITICAL();
		xTaskCreate(
		(TaskFunction_t)TaskGrouplist[ID].pxTaskCode, 
		(const char * )TaskGrouplist[ID].pcName, 
		(uint16_t) TaskGrouplist[ID].usStackDepth, 
		(void *)TaskGrouplist[ID].pvParameters,
		(UBaseType_t)TaskGrouplist[ID].uxPriority, 
		(TaskHandle_t *)TaskGrouplist[ID].pxCreatedTask);
		taskEXIT_CRITICAL();
	}
	SetTaskFlag(ID,TASK_CLEAR);	
}

